<?php
use common\service\StaticService;
use backend\assets\AdminAsset;
use common\service\GlobalUrlService;
StaticService::includeAppJsStatic(GlobalUrlService::buildStaticUrl('/backend/qiniu.min.js'),AdminAsset::class);
StaticService::includeAppJsStatic(GlobalUrlService::buildStaticUrl('/backend/banner/banner-update.js'),AdminAsset::class);
?>

<div class="layui-card">
    <div class="layui-card-header">添加banner</div>
    <div class="layui-card-body">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">显示平台</label>
                <div class="layui-inline">
                    <input type="radio" name="platform" value="1" title="B端" <?php if ($data['show_platform'] == 1):echo 'checked="checked"'; endif;?> lay-filter='platform'>
                </div>
                <div class="layui-inline">
                    <input type="radio" name="platform" value="0" title="C端" <?php if ($data['show_platform'] == 0):echo 'checked="checked"'; endif;?> lay-filter='platform'>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">跳转类型</label>
                <div class="layui-inline hd" <?php if ($data['show_platform'] == 1):echo 'style="display:none"'; endif;?> >
                    <input type="radio" name="type" value="1" title="活动" <?php if ($data['type'] == 1):echo 'checked="checked"'; endif;?> lay-filter='type'>
                </div>
                <div class="layui-inline sj" <?php if ($data['show_platform'] == 1):echo 'style="display:none"'; endif;?>>
                    <input type="radio" name="type" value="2" title="商家" <?php if ($data['type'] == 2):echo 'checked="checked"'; endif;?> lay-filter='type'>
                </div>
                <div class="layui-inline sp" <?php if ($data['show_platform'] == 0):echo 'style="display:none"'; endif;?>>
                    <input type="radio" name="type" value="2" title="商品" <?php if ($data['type'] == 3):echo 'checked="checked"'; endif;?> lay-filter='type'>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">跳转ID</label>
                <div class="layui-inline">
                    <input type="text" class="layui-input oid" name="oid" value="<?= $data['oid']?>">
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" style="width:120px;">活动或商家ID</label>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">显示</label>
                <div class="layui-inline">
                    <input type="radio" name="is_del" value="0" title="显示" <?php if ($data['is_del'] == 0):echo 'checked="checked"'; endif;?>>
                </div>
                <div class="layui-inline">
                    <input type="radio" name="is_del" value="1" title="隐藏" <?php if ($data['is_del'] == 1):echo 'checked="checked"'; endif;?>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">banner图</label>
                <div class="layui-inline">
                    <label class="layui-form-label label-pic" for="bannerpic">选择图片</label>
                    <input type="file" id="bannerpic" class="bannerpic" style="display:none;">
                    <div class="p40">
                        <label for="bannerpic">
                            <img src="<?= GlobalUrlService::buildCdnUrl($data['img_url'])?>" class="pic pic-pic">
                        </label>
                        <input type="hidden" value="<?= $data['img_url']?>" class="hidden-pic" name="">
                    </div>
                </div>
            </div>
        </form>
        <input type="hidden" value="<?= $data['id']?>" class="id" name="">
        <div class="layui-form-item">
            <a class="layui-btn" id="qued">保存</a>
            <a class="layui-btn layui-btn-primary" href="<?= GlobalUrlService::buildAdminUrl('banner/banner-index')?>">取消</a>
        </div>
    </div>
</div>

<style>
    .p40{padding-top:45px;}
    .pic{width:270px;height:170px;}
    .default{width:170px;height:170px;}
    .label-pic{text-align:center;border:1px solid #ccc;width:80px;cursor:pointer;}
</style>